package cn.tedu;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class Demo02 {
    public static void main(String[] args) {


        try (Connection conn = DBUtils.getConn()){


            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入英雄名:");
            String name = scanner.nextLine();
            System.out.println("请输入价格:");
            double money = scanner.nextDouble();

            Statement s = conn.createStatement();
            s.executeUpdate("insert into hero values(null,'"+name+"','"+money+"')");


            System.out.println("执行完毕!");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
